home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 8 / Night Owl CD-ROM (NOPV8) (Night Owl Publisher) (1993).ISO / 034a / aecur101.arj / CONTRIB / CURSES / SRC / DELWIN.C < prev    next >
C/C++ Source or Header  |  1990-03-08  |  641b  |  34 lines

  1. /*------------------------------------------------------------
  2.  * 
  3.  *  delwin.c
  4.  * 
  5.  *  copyright (c) 1987,88,89,90 J. Alan Eldridge
  6.  *
  7.  *  deletes a window structure, freeing malloc'ed memory
  8.  *
  9.  *  NOTE: deleting a subwindow does NOT free buffer space
  10.  * 
  11.  *----------------------------------------------------------*/
  12.  
  13. #include "curses.h"
  14.  
  15. int
  16. delwin(win)
  17. WINDOW *win;
  18. {
  19.     if (!(win->flags & _WSUBWIN)) {
  20.         int y = getmaxr(win);
  21.         
  22.         while (y >= 0)
  23.             free(win->buf[y--]);
  24.     }
  25.  
  26.     free(win->buf);
  27.     free(win->firstx);
  28.     free(win->lastx);
  29.     free(win);
  30.  
  31.     return OK;
  32. }
  33.  
  34.